/*
** 2419.c
** 
** Made by (seakage2h)
** Login   <seakage2h@seakage2h-ubuntu>
** 
** Started on  Tue Mar  3 10:49:22 2009 seakage2h
** Last update Sun May 12 01:17:25 2002 Speed Blue
*/

#include <stdio.h>

typedef struct _hash_p          /* compute hash value of each set */
{
    int cubic_hash;             /* a_1^3 + a_2^3 + a_3^3 + ... + a_t^3 */
    int square_hash;            /* a_1^2 + a_2^2 + a_3^2 + ... + a_t^2 */
    char t;                     /* heard t trees falling */
    double hybrid_var;          /* (cubic_hash + square_hash) / t */
} hash_p;

typedef struct _hash_e          /* hash value element(if hash collided) */
{
    int cubic_hash;             /* hash value */
    double hybrid_var;
    struct _hash_e *next;       /* next element with a different hash value */
} hash_e;
     

typedef struct _hash_h          /* hash value list header */
{
    struct _hash_e *first;      /* first element with this hash value */
} hash_h;

#define MAX_P 101
#define MAX_T 101

int main()
{
    char P, T;
    char p, t;
    char i, j;
    int num;                    /* num elements has different hash value */
    hash_e e[MAX_P];
    hash_p ph[MAX_P];
    char set[MAX_P][MAX_T];   /* avoid duplicate (p,t) */

    /* Initialization */
    scanf("%d %d", &P, &T);
    
    for(i = 1; i <= P; i++)
        ph[i].cubic_hash = ph[i].square_hash = ph[i].t = 0;
    for(i = 1; i < P; i++)
        for(j = 1; j < T; j++)
            set[i][j] = 0;

    /* get inputs and compute cubic_hash, square_hash */
    while(scanf("%d %d", &p, &t) == 2)
        if (!set[p][t]){
            set[p][t] = 1;
            ph[p].cubic_hash += t*t*t;
            ph[p].square_hash += t*t;
            ph[p].t++;
        }
        
    /* compute variances */
    for(i = 1; i <= P; i++)
        ph[i].hybrid_var = (ph[i].cubic_hash
